This section provides configuration detail on how to make RESTCONF calls to NSO via IAP. Key highlights of NSO support for RESTCONF are listed along with several use case examples of the RestAction | NSO Manager task.
NSO RESTCONF API
RESTCONF provides a programmatic way of writing configurations to network devices. This feature is NSO-supported.
- NSO 5.x and beyond supports RESTCONF.
- NSO 5.3 is the last release to support both RESTCONF and REST.
- NSO 5.4 is the first release that supports only RESTCONF.
- NSO also supports JSON-RPC and NETCONF.
See Cisco NSO for additional resources and Swagger API documentation.
HTTP Methods
The primary HTTP methods for RESTCONF are listed below.
| Method | CRUD Operation |
|---|---|
GET |
Read |
PATCH |
Update |
PUT |
Create or Replace |
POST |
Create or Operations (reload, default) |
DELETE |
Deletes targeted resource |
⚠ Note: Capitalization is not required when setting a method.
RestAction NSO Manager Task
The restAction task is used to handle REST calls to NSO but can also be used to make restAction calls.
Incoming and outgoing variables for the task are presented in the table below.
| Incoming Variable | Type | Description | Example |
|---|---|---|---|
adapterId |
String | Required. The NSO adapter to be used. This will satisfy the location and AAA requirements of the restConf call. |
Local NSO |
params |
Object | Required. Parameters such as path, contentType and method to complete the call. |
path - /restconf/data/tail-ncs:devices/contentType - application/yang-data+jsonaccept - application/yang-data+jsonmethod – GET, PATCH, PUT, POST, DELETE |
body |
Object | Required. The device payload to send to NSO. | C-IOS1 C-IOS2 |
| Outgoing Variable | Type | Description |
|---|---|---|
result |
Object | An array of results. |
Figure 1: RestAction Task Dialog

Figure 2: RestAction Task Variables

RESTCONF Examples
This section provides several restAction examples. Sample input values are used to illustrate the Reference variable you would enter for each Incoming Variable on the task dialog.
GET
This example provides information on NSO for the device name C-IOS1.
Variable: adapterId
"Local NSO"
Variable: params
{
"path": "/restconf/data/tailf-ncs:devices/device=C-IOS1",
"contentType": "application/yang-data+json",
"accept": "application/yang-data+json",
"method": "GET"
}
Variable: body
{ }
PATCH
This example adds an interface config to the C-IOS1 device.
Variable: adapterId
"Local NSO"
Variable: params
{
"path": "/restconf/data/tailf-ncs:devices/device=C-IOS1/config",
"accept": "application/yang-data+json",
"contentType": "application/yang-data+json",
"method": "PATCH“
}
Variable: body
{
"config": {
"tailf-ned-cisco-ios:interface": {
"Loopback": [
{
"name": "1",
"ip": {
"address": {
"primary": {
"address": "127.0.0.1",
"mask": "255.0.0.0"
}
}
}
}
]
}
}
}
PUT
This example updates an interface config to the C-IOS1 device.
Variable: adapterId
"Local NSO"
Variable: params
{
"path": "/restconf/data/tailf-ncs:devices/device=C-IOS1/config/tailf-ned-cisco-ios:interface/Loopback=1/ip",
"accept": "application/yang-data+json",
"contentType": "application/yang-data+json",
"method": "PUT“
}
Variable: body
{
"ip": {
"address": {
"primary": {
"address": "127.0.0.2",
"mask": "255.0.0.0"
}
}
}
}
POST
This example creates a device on NSO named C-IOS1.
Variable: adapterId
"Local NSO"
Variable: params
{
"path": "/restconf/data/tailf-ncs:devices",
"contentType": "application/yang-data+json",
"accept": "application/yang-data+json",
"method": "POST“
}
Variable: body
{
"tailf-ncs:device": {
"name": “C-IOS1",
"address": "127.0.0.1",
"port": 10022,
"authgroup": "default",
"device-type": {
"cli": {
"ned-id": "cisco-ios-cli-6.23:cisco-ios-cli-6.23"
}
}
}
}
DELETE
This example deletes the C-IOS1 device.
Variable: adapterId
"Local NSO"
Variable: params
{
"path": "/restconf/data/tailf-ncs:devices/device=C-IOS1",
"accept": "application/yang-data+json",
"contentType": "application/yang-data+json",
"method": “DELETE“
}
Variable: body
{ }
Automation Examples
Picture below is an example Gen 1 workflow (automation) using RESTCONF to:
- Onboard a device.
- Perform a
fetch-ssh-keyaction. - Perform a
sync-fromaction. - Delete a device.
Figure 3: RESTCONF Workflow

Add Device
This sample illustrates the Variables used to add a device.
Figure 4: RESTCONF Add Device

Fetch SSH Keys
This sample illustrates the Variables used to fetch-host-keys in a device.
Figure 5: RESTCONF Fetch Host Keys

Sync-From
This sample illustrates the Variables used to sync-from a device.
Figure 6: RESTCONF Sync-From

Delete Device
This sample illustrates the Variables used to delete a device.
Figure 7: RESTCONF Delete Device

Service Model Example
The Variables pictured below illustrate how to apply a Service Model using the commit-queue tag with optional features for optimization (i.e., no-out-of-sync-check, continue-on-error).
Figure 8: RESTCONF Service Model Input

Figure 9: RESTCONF Service Model Output
